from tortoise import fields, models

class Carousel(models.Model):
    """轮播图"""
    id = fields.IntField(pk=True, description='主键')
    carousel_url = fields.CharField(max_length=255, description='轮播图地址')
    redirect_url = fields.CharField(max_length=255, description='跳转地址')
    carousel_rank = fields.IntField(max_length=11, description='轮播图排序')
    is_delete = fields.BooleanField(default=False, description='是否删除')
    create_time = fields.DatetimeField(auto_now_add=True, description='创建时间')
    update_time = fields.DatetimeField(auto_now=True, description='更新时间')
    create_user = fields.CharField(max_length=255, description='创建人')
    update_user = fields.CharField(max_length=255, description='更新人')

    class Meta:
        table = 'tb_mall_carousel'
        table_description = '商城轮播图'

    def __repr__(self):
        return f"<Carousel(id={self.id}, carousel_url={self.carousel_url})>"

    __str__ = __repr__